package com.weishu.core.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.weishu.core.entity.CwDealPerDay;
import com.weishu.core.mapper.CwDealPerDayMapper;
import com.weishu.core.service.ICwDealPerDayService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.stereotype.Service;

import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.Date;

/**
 * <p>
 *  服务实现类
 * </p>
 *
 * @author zgx
 * @since 2021-10-19
 */
@Service
public class CwDealPerDayServiceImpl extends ServiceImpl<CwDealPerDayMapper, CwDealPerDay> implements ICwDealPerDayService {

    @Override
    public CwDealPerDay getFee(String startDate, String endDate) throws ParseException {
        SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd");
        Date parse = null;
        Date parse1 = null;
        if (startDate!=null && !"".equals(startDate) && endDate!=null &&!"".equals(endDate)){
            
            parse= simpleDateFormat.parse(startDate);
            parse1 = simpleDateFormat.parse(endDate);
        }
        
        return this.getBaseMapper().getFee(parse,parse1);
    }

    @Override
    public CwDealPerDay getOutFee(String startDate, String endDate) throws ParseException {
        SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd");
        Date parse = null;
        Date parse1 = null;
        if (startDate!=null && !"".equals(startDate) && endDate!=null &&!"".equals(endDate)){

            parse= simpleDateFormat.parse(startDate);
            parse1 = simpleDateFormat.parse(endDate);
        }

        return this.getBaseMapper().getOutFee(parse,parse1);
    }
}
